package asruby.runtime
{
import asruby.Ruby;
import asruby.lang.RubyArray;
import asruby.lang.RubyClass;
import asruby.lang.RubyFloat;
import asruby.lang.RubyHash;
import asruby.lang.RubyInteger;
import asruby.lang.RubyString;
import asruby.runtime.buildin.InstanceVariables;
import asruby.runtime.buildin.InternalVariables;
import asruby.lang.RubySymbol;	
public interface IRubyObject 
{  	
    function callSuper(context:ThreadContext, args:Array, block:Block):IRubyObject;

    function callMethod(context:ThreadContext, name:String):IRubyObject;
    function callMethod2(context:ThreadContext, name:String, arg:IRubyObject):IRubyObject;
    function callMethod3(context:ThreadContext, name:String, args:Array):IRubyObject;
    function callMethod4(context:ThreadContext, name:String, args:Array, block:Block):IRubyObject;
    function callMethod5(context:ThreadContext, methodIndex:int, name:String):IRubyObject;
    function callMethod6(context:ThreadContext, methodIndex:int, name:String, arg:IRubyObject):IRubyObject;
    
    /**
     * RubyMethod isNil.
     * @return Boolean
     */
    function isNil():Boolean;
    
    /**
     *
     * @return
     */
    function isTrue():Boolean;
    
    /**
     * RubyMethod isTaint.
     * @return Boolean
     */
    function isTaint():Boolean;
    
    /**
     * RubyMethod setTaint.
     * @param b
     */
    function setTaint(b:Boolean):void;
    
    /**
     * Infect this object using the taint of another object
     * @param obj
     * @return
     */
    //function infectBy(obj:IRubyObject):IRubyObject;
    
    /**
     * RubyMethod isFrozen.
     * @return Boolean
     */
    function isFrozen():Boolean;
    
    /**
     * RubyMethod setFrozen.
     * @param b
     */
    function setFrozen(b:Boolean):void;
    
    /**
     *
     * @return
     */
    function isImmediate():Boolean;
    
    /**
     * RubyMethod getRubyClass.
     * @return
     */
    function getMetaClass():RubyClass;
    
    /**
     * RubyMethod getSingletonClass.
     * @return RubyClass
     */
    function getSingletonClass():RubyClass;;
    
    /**
     * RubyMethod getType.
     * @return RubyClass
     */
    function getType():RubyClass;;
    
    /**
     * RubyMethod respondsTo.
     * @param string
     * @return Boolean
     */
    function respondsTo(string:String):Boolean;
    
    /**
     * RubyMethod getRuntime.
     * @return
     */
    function getRuntime():Ruby;
    
    /**
     * RubyMethod getJavaClass.
     * @return Class
     */
    function getJavaClass():Class;
    
    /**
     * Convert the object into a symbol name if possible.
     *
     * @return String the symbol name
     */
    function asJavaString():String;
    
    /** rb_obj_as_string
     * @return
     */
    function asString():RubyString;
    
    /**
     * Methods which perform to_xxx if the object has such a method
     * @return
     */
    function convertToArray():RubyArray;
    /**
     *
     * @return
     */
    function convertToHash():RubyHash;    
    /**
    *
    * @return
    */    
    function convertToFloat():RubyFloat;
    /**
     *
     * @return
     */
    function convertToInteger1():RubyInteger;
    /**
     *
     * @return
     */
    function convertToInteger2(convertMethodIndex:int, convertMethod:String):RubyInteger;
    /**
     *
     * @return
     */
    function convertToString():RubyString;
    
    /**
     *
     * @return
     */
    function anyToString():IRubyObject;
    
    /**
     *
     * @return
     */
    function checkStringType():IRubyObject;
    
    /**
     *
     * @return
     */
    function checkArrayType():IRubyObject;

    /**
     * RubyMethod dup.
     * @return
     */
    //function dup():IRubyObject;
    
    /**
     * RubyMethod inspect.
     * @return String
     */
    //function inspect():IRubyObject;
    
    /**
     * RubyMethod rbClone.
     * @return IRubyObject
     */
    //function rbClone():IRubyObject;

    /**
     * @return true if an object is Ruby Module instance (note that it will return false for Ruby Classes).
     * If is_a? semantics is required, use <code>(someObject instanceof RubyModule)</code> instead.
     */
    function isModule():Boolean;    
    
    /**
     * @return true if an object is Ruby Class instance (note that it will return false for Ruby singleton classes). 
     * If is_a? semantics is required, use <code>(someObject instanceof RubyClass/MetaClass)</code> instead.
     */
    function isClass():Boolean;
    
    /**
     * Our version of Data_Wrap_Struct.
     *
     * This method will just set a private pointer to the object provided. This pointer is transient
     * and will not be accessible from Ruby.
     *
     * @param obj the object to wrap
     */
    //function dataWrapStruct(obj:Object):void;
    
    /**
     * Our version of Data_Get_Struct.
     *
     * Returns a wrapped data value if there is one, otherwise returns null.
     *
     * @return the object wrapped.
     */
    //function dataGetStruct():Object;
    
    /**
     *
     * @return
     */
    function id():IRubyObject;
    
    function op_equal(context:ThreadContext, other:IRubyObject):IRubyObject;
    function op_eqq(context:ThreadContext, other:IRubyObject):Boolean;
    function eql(other:IRubyObject):Boolean;

    //
    // COMMON VARIABLE METHODS
    //

    /**
     * Returns true if object has any variables, defined as:
     * <ul>
     * <li> instance variables
     * <li> class variables
     * <li> constants
     * <li> internal variables, such as those used when marshalling Ranges and Exceptions
     * </ul>
     * @return true if object has any variables, else false
     */
   //	function hasVariables():Boolean;

    /**
     * @return the count of all variables (ivar/cvar/constant/internal)
     */
   // function getVariableCount():int;
    
    /**
     * Sets object's variables to those in the supplied list,
     * removing/replacing any previously defined variables.  Applies
     * to all variable types (ivar/cvar/constant/internal).
     * 
     * @param variables the variables to be set for object 
     */
    //function syncVariables(variables:Array):Array;
    
    /**
     * @return a list of all variables (ivar/cvar/constant/internal)
     */
   //	function getVariableArray():Array;

    //
    // INSTANCE VARIABLE METHODS
    //
    
   //	function getInstanceVariables():InstanceVariables;

    //
    // INTERNAL VARIABLE METHODS
    //

   // function getInternalVariables():InternalVariables;

    /**
     * @return a list of all variable names (ivar/cvar/constant/internal)
     */
   	function getVariableNameArray():Array;
    
    function toString():String;
    
    function getArray():Array;
    
    function getLongValue():Number;
    
    function getBlock():Block;	

}
}